class Solution {
public:
    void dfs(string& digits, int index)
    {
        if (path.size() == digits.size())
        {
            ret.push_back(path);
            return;
        }

        int num = digits[index] - '0';
        for (int i = 0; i < arr_string[num].size(); i++)
        {
            path += arr_string[num][i];

            dfs(digits, index + 1);
            path.pop_back();
        }
    }

    vector<string> letterCombinations(string digits) {
        if (digits.size() == 0)
            return ret;
            
        dfs(digits, 0);

        return ret;
    }
private:
    vector<string> ret;
    string path;
    vector<string> arr_string = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
};